﻿using System;
using System.Collections.Generic;
using System.Text;
using Watchdog.Dal;
using Watchdog.Bll;
using Watchdog.Bll.Base;

namespace Watchdog.Bll.Factory {

    public partial class ScheduleFactory {
        public static List<Schedule> GetPending () {
            List<Schedule> outlist = new List<Schedule> ();
            Watchdog.Facade.Schedule[] list = Dal.DataClient.Current.ScheduleGetPending();
            foreach (Watchdog.Facade.Schedule item in list)
                outlist.Add ( new Schedule ( item ) );
            return outlist;
        }

        public static List<Schedule> GetLocked () {
            List<Schedule> outlist = new List<Schedule> ();
            try {
                Watchdog.Facade.Schedule[] list = Dal.DataClient.Current.ScheduleGetLocked ();
                foreach (Watchdog.Facade.Schedule item in list) {
                    outlist.Add (new Schedule (item));
                }
            } catch (System.Exception ex) {
                Log.Write (Severity.Error, null, ex);
            }
            return outlist;
        }
        public static Schedule GetFromFacade ( Facade.Schedule schedule ) {
            return new Schedule (schedule);
        }
	}
}
